package com.zhima.constant;

import java.util.concurrent.TimeUnit;

public class ContestRedisConstant {
    /**
     * CONTEST_APPLY_PREFIX{contestId}
     * 比赛有哪些人报名
     * value是set
     * 保存用户id
     */
    public final static String CONTEST_APPLY_PREFIX = "contest:apply:";

    /**
     * CONTEST_LEADERBOARD_PREFIX{contestId}
     * 比赛排名信息
     * value是zset
     * 用户id （score为用户本次比赛的总得分）
     */
    public final static String CONTEST_SCOREBOARD_PREFIX = "contest:scoreboard:";
    /**
     * CONTEST_SCORE_PREFIX{contestId}
     * 某一场比赛的所有用户的详细得分情况
     * value为hash
     * key为用户id
     * value为用户得分详情
     * key: userId
     * value: '
     * [
     * {
     * questionId: 'qdwsasdasdasdasd',
     * isSubmit: true,
     * score: 100,
     * fullMark: 100,
     * useTime: 20(单位是分钟)
     * }
     * ]
     * '
     */
    public final static String CONTEST_SCORE_PREFIX = "contest:score:";
    public final static String CONTEST_SCORE_LOCK_PREFIX = "contest:scoreboard:lock:%s";
    public final static TimeUnit CONTEST_SCORE_LOCK_TIME_UNIT = TimeUnit.HOURS;
    public final static Long CONTEST_SCORE_LOCK_TIME_OUT = 30L;
    /**
     * CONTEST_SUBMIT_PREFIX{contestId}:{userId}
     * 比赛中用户的提交记录
     * value是bitmap
     */
    public final static String CONTEST_SUBMIT_PREFIX = "contest:submit:";
    /**
     * CONTEST_AC_PREFIX{contestId}
     * 记录本场比赛中的题目是否有人已经AC
     * value是hash
     * key是题目id，value是第一个ac的用户id
     */
    public final static String CONTEST_AC_PREFIX = "contest:ac:";
    /**
     * CONTEST_FIRST_AC_USER_PREFIX{contestId}
     * 记录本场比赛每道题目是谁第一个ac的
     * value是hash
     * key是题目id，value是userId
     */
    public final static String CONTEST_FIRST_AC_USER_PREFIX = "contest:firstAcUser:";
    /**
     * 用户报名了哪些比赛
     */
    public final static String CONTEST_USER_JOIN_PREFIX = "user:contest:join:";
    /**
     * 比赛信息是否填充完毕
     * 默认是0
     */
    public final static String CONTEST_INIT_PREFIX = "contest:init:";

}
